#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H

#include <QtGui/QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QTimer>

class LoginDialog : public QWidget
{
    Q_OBJECT

    QLabel UserLabel;
    QLabel PwdLabel;
    QLineEdit UserEdit;
    QLineEdit PwdEdit;
    QPushButton RegisterBtn;
    QPushButton LoginBtn;
    QPushButton CancelBtn;
    QString m_user;
    QString m_pwd;
    QLabel m_captchaLbl;
    QLineEdit m_captchaEdit;

    QString m_captchaString;

    QString getCaptcha();
    Qt::GlobalColor getColor();
    QTimer m_timer;

signals:
    void Register();
    void Login();

protected:
    void paintEvent(QPaintEvent *);
    void mousePressEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);
    bool eventFilter(QObject*, QEvent*);
public slots:
    void LoginBtn_Clicked();
    void CancelBtn_Clicked();
    void Register_Clicked();
    void onTimeOut();
public:
    LoginDialog(QWidget *parent = 0);
    QString getUser();
    QString getPwd();
    ~LoginDialog();
};

#endif // LOGINDIALOG_H
